package com.algorithm.base.sort;

public class SelectSort {
    public static void sortArray(int a[]) {
        int n = a.length;
        for (int i = 0; i < n; i++) {
            int index = i;
            int value = a[i];
            for (int j = i + 1; j < n; j++) {
                if (a[j] < value) {
                    value = a[j];
                    index = j;
                }
            }
            a[index] = a[i];
            a[i] = value;
        }
    }
}
